package com.hikvision.tcm.controller;

import com.hikvision.tcm.util.SpringBeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author :jianghui
 * @date : 2022/11/04 0:13
 */
@RestController
@RequestMapping("/nacos/config")
@RefreshScope
public class TestNacosConfigController {

    @Value("${server.port}")
    private String port ;

    @Value("${system.version}")
    private String version ;

    @GetMapping("")
    public String getConfig() {
        String subscribedServices = SpringBeanUtils.getApplicationValue("dubbo.cloud.subscribed-services");

        return "port:" + port + ",subscribedServices:" + subscribedServices + ",version:" + version;
    }
}
